#include "KRuntime.h"
#include "KInterlock.h"

namespace krt
{

	long LockInc(volatile long* dst)
	{
#ifdef _WINDOWS
		return ::InterlockedIncrement(dst);
#endif
	}

	long LockDec(volatile long* dst)
	{
#ifdef _WINDOWS
		return ::InterlockedDecrement(dst);
#endif
	}

	long LockExchange(volatile long* dst, long NewValue)
	{
#ifdef _WINDOWS
		return ::InterlockedExchange(dst, NewValue);
#endif
	}

	long LockCmpExchange(volatile long* dst, long NewValue, long comperand)
	{
		return ::InterlockedCompareExchange(dst, NewValue, comperand);
	}
}